﻿@page "/settings/index"
@inject IJSRuntime JS
@inject NavigationManager NavigationManager

<MAppBar App>
    <NavLink @onclick="Back">
        <MButton icon>
            <MIcon>mdi-arrow-left</MIcon>
        </MButton>
    </NavLink>
    <MToolbarTitle>设置</MToolbarTitle>

</MAppBar>

<!-- 根据应用组件来调整你的内容 -->
<MMain>
    <!-- 给应用提供合适的间距 -->
    <MContainer Fluid>
        <MList TwoLine>
            <MListItemGroup Color="primary">
                <MListItem @onclick="@(_=>OpenPageAsync("about"))">
                    <MListItemIcon>
                        <MIcon XLarge Color="orange darken-2">
                            mdi-information
                        </MIcon>
                    </MListItemIcon>
                    <MListItemContent>
                        <MListItemTitle>关于</MListItemTitle>
                    </MListItemContent>
                </MListItem>
                <MListItem @onclick="@(_=>OpenPageAsync("checkupdate"))">
                        <MListItemIcon>
                        <MIcon XLarge Color="orange darken-2">
                            mdi-package-down
                        </MIcon>
                        </MListItemIcon>
                    <MListItemContent>
                        <MListItemTitle>检查更新</MListItemTitle>
                    </MListItemContent>
                </MListItem>
            </MListItemGroup>
        </MList>
    </MContainer>
</MMain>


@code {
    private async Task Back()
    {
        await JS.InvokeVoidAsync("window.history.back");
    }

    private async Task OpenPageAsync(string pageName)
    {
        NavigationManager.NavigateTo($"/settings/{pageName}");
    }
}
